#include "dyn_specialFunctions_besselk.h"

BesselK::BesselK(double _order)
{
    setOrder(_order);
}

double BesselK::operator ()(const double x)
{
    double nu = fabs(order);
    return boost::math::cyl_bessel_k(nu,x);
}

d_complex BesselK::operator ()(const d_complex z)
{
    // Input values
    double zr = real(z);
    double zi = imag(z);
    double nu = fabs(order);
    int kode = 1;
    int N = 1;

    // Output values
    double cyr,cyi;
    int nz,ierr;

    // External function call
    zbesk_(&zr,&zi,&nu,&kode,&N,&cyr,&cyi,&nz,&ierr);

    d_complex answer(cyr,cyi);

    return answer;
}
